//TOWN SCRIPT TEMPLATE

begintownscript;

variables;

body;

beginstate INIT_STATE;
//called when the party enters the town

break;

beginstate EXIT_STATE;
//called when the party leaves the town

break;

beginstate START_STATE;
//called every turn when the party is in the town
if (get_flag(6,1) == 8) {
	message_dialog("All of the frowneys are dead. The Smiley Mage magically unlocks the door and they both rush in to help King Smiley.","");
	set_flag(6,1,0);
	set_flag(5,6,1);
	erase_char(17);
	erase_char(18);
	force_instant_terrain_redraw();
	activate_hidden_group(1);
}

break;

beginstate 11;
	if(get_flag(5,2)==0){
	activate_hidden_group(2);
	message_dialog("You step out into the hall. It is filled with frowneys trying to get through the door to the throne room, and a Smiley Mage and a Smiley Knight trying to stop them.","King Smiley has barricaded himself in with his enemy.");
	set_flag(5,2,1);
}
break;

beginstate 15;
	if(get_flag(5,5)==0){
	message_dialog("You rush in to help King Smiley, but...","He is dead. His servants fight madly to avenge him.");
	set_flag(5,5,1);
	set_attitude(6,10);
}
break;